From: Stan Grishin Date: Fri, 1 Aug 2025 01:42:12 +0000 (+0000) Subject: luci-app-adblock-fast: sync with principal package X-Git-Url: http://git.openwrt.org/%22https:/collectd.org//%22http:/www.crowdsec.net/%22/%22https:/collectd.org/%22http:/www.crowdsec.net/%22?a=commitdiff_plain;h=c26b8f28fe5094eae882762c6323d981abde104c;p=project%2Fluci.git luci-app-adblock-fast: sync with principal package Signed-off-by: Stan Grishin --- diff --git a/applications/luci-app-adblock-fast/Makefile b/applications/luci-app-adblock-fast/Makefile index 1f7ac0cf81..3c992dddf2 100644 --- a/applications/luci-app-adblock-fast/Makefile +++ b/applications/luci-app-adblock-fast/Makefile @@ -1,13 +1,13 @@ +# SPDX-License-Identifier: AGPL-3.0-or-later # Copyright 2023-2025 MOSSDeF, Stan Grishin (stangri@melmac.ca). -# This is free software, licensed under AGPL-3.0-or-later. include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-adblock-fast PKG_LICENSE:=AGPL-3.0-or-later PKG_MAINTAINER:=Stan Grishin -PKG_VERSION:=1.1.3 -PKG_RELEASE:=1 +PKG_VERSION:=1.1.4 +PKG_RELEASE:=4 LUCI_TITLE:=AdBlock-Fast Web UI LUCI_URL:=https://github.com/stangri/luci-app-adblock-fast/ diff --git a/applications/luci-app-adblock-fast/README.md b/applications/luci-app-adblock-fast/README.md index 1dae8eadf6..44ef1f8710 100644 --- a/applications/luci-app-adblock-fast/README.md +++ b/applications/luci-app-adblock-fast/README.md @@ -1,4 +1,20 @@ -# README +# luci-app-adblock-fast -Documentation for this project is available at [https://docs.openwrt.melmac.net/luci-app-adblock-fast/](https://docs.openwrt.melmac.net/luci-app-adblock-fast/). +[![OpenWrt](https://img.shields.io/badge/OpenWrt-Compatible-blueviolet)](https://openwrt.org) +[![Web UI](https://img.shields.io/badge/Web_UI-Available-blue)](https://docs.openwrt.melmac.ca/adblock-fast/) +[![Lightweight](https://img.shields.io/badge/Size-Lightweight-brightgreen)](https://openwrt.org/packages/pkgdata/adblock-fast) +[![License](https://img.shields.io/badge/License-AGPL--3.0--or--later-lightgrey)](https://github.com/stangri/adblock-fast/blob/master/LICENSE) +A WebUI for fast, lightweight DNS-based ad-blocker for OpenWrt that works with dnsmasq, smartdns, or unbound. +It runs once to process and install blocklists, then exits — keeping memory usage low. + +## Features of principal package + +- Minimal runtime memory use +- Parallel blocklist download and processing +- Persistent cache support +- Optional Web UI for custom block/allow lists +- Reverts if DNS resolution fails after restart + +📚 **Full documentation:** +[https://docs.openwrt.melmac.ca/adblock-fast/](https://docs.openwrt.melmac.ca/adblock-fast/) diff --git a/applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js b/applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js index d89e228953..1b6c74a1e6 100644 --- a/applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js +++ b/applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js @@ -11,12 +11,29 @@ var pkg = { get Name() { return "adblock-fast"; }, + get LuciCompat() { + return 7; + }, get ReadmeCompat() { return ""; }, get URL() { return ( - "https://docs.openwrt.melmac.net/" + pkg.Name + "/" + pkg.ReadmeCompat + "https://docs.openwrt.melmac.ca/" + + pkg.Name + + "/" + + (pkg.ReadmeCompat ? pkg.ReadmeCompat + "/" : "") + ); + }, + isVersionMismatch: function (luci, pkg, rpcd) { + return luci !== pkg || pkg !== rpcd || luci !== rpcd; + }, + formatMessage: function (info, template) { + if (!template) return _("Unknown message") + "
"; + return ( + (Array.isArray(info) + ? template.format(...info) + : template.format(info || " ")) + "
" ); }, humanFileSize: function (bytes, si = false, dp = 2) { @@ -51,6 +68,12 @@ var getPlatformSupport = rpc.declare({ params: ["name"], }); +var getUbusInfo = rpc.declare({ + object: "luci." + pkg.Name, + method: "getUbusInfo", + params: ["name"], +}); + var _setInitAction = rpc.declare({ object: "luci." + pkg.Name, method: "setInitAction", @@ -87,437 +110,466 @@ var RPC = { var status = baseclass.extend({ render: function () { - return Promise.all([L.resolveDefault(getInitStatus(pkg.Name), {})]).then( - function (data) { - var reply = { - status: (data[0] && data[0][pkg.Name]) || { - enabled: false, - status: null, - running: null, - version: null, - errors: [], - warnings: [], - force_dns_active: null, - force_dns_ports: [], - entries: null, - dns: null, - outputFile: null, - outputCache: null, - outputGzip: null, - outputFileExists: null, - outputCacheExists: null, - outputGzipExists: null, - leds: [], - }, + return Promise.all([ + L.resolveDefault(getInitStatus(pkg.Name), {}), + L.resolveDefault(getUbusInfo(pkg.Name), {}), + ]).then(function (data) { + var reply = { + status: data[0]?.[pkg.Name] || { + enabled: false, + status: null, + packageCompat: 0, + rpcdCompat: 0, + running: null, + version: null, + errors: [], + warnings: [], + force_dns_active: null, + force_dns_ports: [], + entries: null, + dns: null, + outputFile: null, + outputCache: null, + outputGzip: null, + outputFileExists: null, + outputCacheExists: null, + outputGzipExists: null, + leds: [], + }, + ubus: data[1]?.[pkg.Name]?.instances?.main?.data || { + packageCompat: 0, + errors: [], + warnings: [], + }, + }; + + if ( + pkg.isVersionMismatch( + pkg.LuciCompat, + reply.status.packageCompat, + reply.status.rpcdCompat + ) + ) { + reply.ubus.warnings.push({ + code: "warningInternalVersionMismatch", + info: [ + reply.ubus.packageCompat, + pkg.LuciCompat, + reply.status.rpcdCompat, + '', + "", + ], + }); + } + var text = ""; + var outputFile = reply.status.outputFile; + var outputCache = reply.status.outputCache; + var statusTable = { + statusNoInstall: _("%s is not installed or not found").format(pkg.Name), + statusStopped: _("Stopped"), + statusStarting: _("Starting"), + statusProcessing: _("Processing lists"), + statusRestarting: _("Restarting"), + statusForceReloading: _("Force Reloading"), + statusDownloading: _("Downloading lists"), + statusFail: _("Failed to start"), + statusSuccess: _("Active"), + }; + + var header = E("h2", {}, _("AdBlock-Fast - Status")); + var statusTitle = E( + "label", + { class: "cbi-value-title" }, + _("Service Status") + ); + if (reply.status.version) { + text += _("Version %s").format(reply.status.version) + " - "; + switch (reply.status.status) { + case "statusSuccess": + text += statusTable[reply.status.status] + "."; + text += + "
" + + _("Blocking %s domains (with %s).").format( + reply.status.entries, + reply.status.dns + ); + if (reply.status.outputGzipExists) { + text += "
" + _("Compressed cache file created."); + } + if (reply.status.force_dns_active) { + text += "
" + _("Force DNS ports:"); + reply.status.force_dns_ports.forEach((element) => { + text += " " + element; + }); + text += "."; + } + break; + case "statusStopped": + if (reply.status.enabled) { + text += statusTable[reply.status.status] + "."; + } else { + text += + statusTable[reply.status.status] + " (" + _("Disabled") + ")."; + } + if (reply.status.outputCacheExists) { + text += "
" + _("Cache file found."); + } else if (reply.status.outputGzipExists) { + text += "
" + _("Compressed cache file found."); + } + break; + case "statusRestarting": + case "statusForceReloading": + case "statusDownloading": + case "statusProcessing": + text += statusTable[reply.status.status] + "..."; + break; + default: + text += statusTable[reply.status.status] + "."; + break; + } + } else { + text = _("Not installed or not found"); + } + var statusText = E("div", {}, text); + var statusField = E("div", { class: "cbi-value-field" }, statusText); + var statusDiv = E("div", { class: "cbi-value" }, [ + statusTitle, + statusField, + ]); + + var warningsDiv = []; + if (reply.ubus.warnings && reply.ubus.warnings.length) { + var warningTable = { + warningInternalVersionMismatch: _( + "Internal version mismatch (package: %s, luci app: %s, luci rpcd: %s), you may need to update packages or reboot the device, please check the %sREADME%s." + ), + warningExternalDnsmasqConfig: _( + "Use of external dnsmasq config file detected, please set '%s' option to '%s'" + ).format("dns", "dnsmasq.conf"), + warningMissingRecommendedPackages: _( + "Missing recommended package: '%s'" + ), + warningOutdatedLuciPackage: _( + "The WebUI application (luci-app-adblock-fast) is outdated, please update it" + ), + warningOutdatedPrincipalPackage: _( + "The principal package (adblock-fast) is outdated, please update it" + ), + warningInvalidCompressedCacheDir: _( + "Invalid compressed cache directory '%s'" + ), + warningFreeRamCheckFail: _("Can't detect free RAM"), + warningSanityCheckTLD: _("Sanity check discovered TLDs in %s"), + warningSanityCheckLeadingDot: _( + "Sanity check discovered leading dots in %s" + ), }; + var warningsTitle = E( + "label", + { class: "cbi-value-title" }, + _("Service Warnings") + ); var text = ""; - var outputFile = reply.status.outputFile; - var outputCache = reply.status.outputCache; - var statusTable = { - statusNoInstall: _("%s is not installed or not found").format( + reply.ubus.warnings.forEach((element) => { + if (element.code && warningTable[element.code]) { + text += pkg.formatMessage(element.info, warningTable[element.code]); + } else { + text += _("Unknown warning") + "
"; + } + }); + var warningsText = E("div", {}, text); + var warningsField = E( + "div", + { class: "cbi-value-field" }, + warningsText + ); + warningsDiv = E("div", { class: "cbi-value" }, [ + warningsTitle, + warningsField, + ]); + } + + var errorsDiv = []; + if (reply.ubus.errors && reply.ubus.errors.length) { + var errorTable = { + errorConfigValidationFail: _( + "Config (%s) validation failure!" + ).format("/etc/config/" + pkg.Name), + errorServiceDisabled: _("%s is currently disabled").format(pkg.Name), + errorNoDnsmasqIpset: _( + "The dnsmasq ipset support is enabled, but dnsmasq is either not installed or installed dnsmasq does not support ipset" + ), + errorNoIpset: _( + "The dnsmasq ipset support is enabled, but ipset is either not installed or installed ipset does not support '%s' type" + ).format("hash:net"), + errorNoDnsmasqNftset: _( + "The dnsmasq nft set support is enabled, but dnsmasq is either not installed or installed dnsmasq does not support nft set" + ), + errorNoNft: _( + "The dnsmasq nft sets support is enabled, but nft is not installed" + ), + errorNoWanGateway: _("The %s failed to discover WAN gateway").format( pkg.Name ), - statusStopped: _("Stopped"), - statusStarting: _("Starting"), - statusProcessing: _("Processing lists"), - statusRestarting: _("Restarting"), - statusForceReloading: _("Force Reloading"), - statusDownloading: _("Downloading lists"), - statusFail: _("Failed to start"), - statusSuccess: _("Active"), + errorOutputDirCreate: _("Failed to create directory for %s file"), + errorOutputFileCreate: _("Failed to create '%s' file"), + errorFailDNSReload: _("Failed to restart/reload DNS resolver"), + errorSharedMemory: _("Failed to access shared memory"), + errorSorting: _("Failed to sort data file"), + errorOptimization: _("Failed to optimize data file"), + errorAllowListProcessing: _("Failed to process allow-list"), + errorDataFileFormatting: _("Failed to format data file"), + errorMovingDataFile: _( + "Failed to move temporary data file to '%s'" + ).format(outputFile), + errorCreatingCompressedCache: _("Failed to create compressed cache"), + errorRemovingTempFiles: _("Failed to remove temporary files"), + errorRestoreCompressedCache: _("Failed to unpack compressed cache"), + errorRestoreCache: _("Failed to move '%s' to '%s'").format( + outputCache, + outputFile + ), + errorOhSnap: _("Failed to create block-list or restart DNS resolver"), + errorStopping: _("Failed to stop %s").format(pkg.Name), + errorDNSReload: _("Failed to reload/restart DNS resolver"), + errorDownloadingConfigUpdate: _( + "Failed to download Config Update file" + ), + errorDownloadingList: _("Failed to download %s"), + errorParsingConfigUpdate: _("Failed to parse Config Update file"), + errorParsingList: _("Failed to parse %s"), + errorNoSSLSupport: _("No HTTPS/SSL support on device"), + errorCreatingDirectory: _( + "Failed to create output/cache/gzip file directory" + ), + errorDetectingFileType: _("Failed to detect format %s"), + errorNothingToDo: _( + "No blocked list URLs nor blocked-domains enabled" + ), + errorTooLittleRam: _( + "Free ram (%s) is not enough to process all enabled block-lists" + ), + errorCreatingBackupFile: _("failed to create backup file %s"), + errorDeletingDataFile: _("failed to delete data file %s"), + errorRestoringBackupFile: _("failed to restore backup file %s"), + errorNoOutputFile: _("failed to create final block-list %s"), + errorNoHeartbeat: _( + "Heartbeat domain is not accessible after resolver restart" + ), }; - - var header = E("h2", {}, _("AdBlock-Fast - Status")); - var statusTitle = E( + var errorsTitle = E( "label", { class: "cbi-value-title" }, - _("Service Status") + _("Service Errors") ); - if (reply.status.version) { - text += _("Version %s").format(reply.status.version) + " - "; - switch (reply.status.status) { - case "statusSuccess": - text += statusTable[reply.status.status] + "."; - text += - "
" + - _("Blocking %s domains (with %s).").format( - reply.status.entries, - reply.status.dns - ); - if (reply.status.outputGzipExists) { - text += "
" + _("Compressed cache file created."); - } - if (reply.status.force_dns_active) { - text += "
" + _("Force DNS ports:"); - reply.status.force_dns_ports.forEach((element) => { - text += " " + element; - }); - text += "."; - } - break; - case "statusStopped": - if (reply.status.enabled) { - text += statusTable[reply.status.status] + "."; - } else { - text += - statusTable[reply.status.status] + - " (" + - _("Disabled") + - ")."; - } - if (reply.status.outputCacheExists) { - text += "
" + _("Cache file found."); - } else if (reply.status.outputGzipExists) { - text += "
" + _("Compressed cache file found."); - } - break; - case "statusRestarting": - case "statusForceReloading": - case "statusDownloading": - case "statusProcessing": - text += statusTable[reply.status.status] + "..."; - break; - default: - text += statusTable[reply.status.status] + "."; - break; + var text = ""; + reply.ubus.errors.forEach((element) => { + if (element.code && errorTable[element.code]) { + text += pkg.formatMessage(element.info, errorTable[element.code]); + } else { + text += _("Unknown error") + "
"; } - } else { - text = _("Not installed or not found"); - } - var statusText = E("div", {}, text); - var statusField = E("div", { class: "cbi-value-field" }, statusText); - var statusDiv = E("div", { class: "cbi-value" }, [ - statusTitle, - statusField, + }); + text += _("Errors encountered, please check the %sREADME%s").format( + '', + "!
" + ); + var errorsText = E("div", {}, text); + var errorsField = E("div", { class: "cbi-value-field" }, errorsText); + errorsDiv = E("div", { class: "cbi-value" }, [ + errorsTitle, + errorsField, ]); + } - var warningsDiv = []; - if (reply.status.warnings && reply.status.warnings.length) { - var warningTable = { - warningExternalDnsmasqConfig: _( - "Use of external dnsmasq config file detected, please set '%s' option to '%s'" - ).format("dns", "dnsmasq.conf"), - warningMissingRecommendedPackages: _( - "Missing recommended package: '%s'" - ), - warningOutdatedLuciPackage: _( - "The WebUI application (luci-app-adblock-fast) is outdated, please update it" - ), - warningOutdatedPrincipalPackage: _( - "The principal package (adblock-fast) is outdated, please update it" - ), - warningInvalidCompressedCacheDir: _( - "Invalid compressed cache directory '%s'" - ), - warningFreeRamCheckFail: _("Can't detect free RAM"), - }; - var warningsTitle = E( - "label", - { class: "cbi-value-title" }, - _("Service Warnings") - ); - var text = ""; - reply.status.warnings.forEach((element) => { - if (element.id && warningTable[element.id]) - text += - warningTable[element.id].format(element.extra || " ") + - "
"; - else text += _("Unknown warning") + "
"; - }); - var warningsText = E("div", {}, text); - var warningsField = E( - "div", - { class: "cbi-value-field" }, - warningsText - ); - warningsDiv = E("div", { class: "cbi-value" }, [ - warningsTitle, - warningsField, - ]); - } - - var errorsDiv = []; - if (reply.status.errors && reply.status.errors.length) { - var errorTable = { - errorConfigValidationFail: _( - "Config (%s) validation failure!" - ).format("/etc/config/" + pkg.Name), - errorServiceDisabled: _("%s is currently disabled").format( - pkg.Name - ), - errorNoDnsmasqIpset: _( - "The dnsmasq ipset support is enabled, but dnsmasq is either not installed or installed dnsmasq does not support ipset" - ), - errorNoIpset: _( - "The dnsmasq ipset support is enabled, but ipset is either not installed or installed ipset does not support '%s' type" - ).format("hash:net"), - errorNoDnsmasqNftset: _( - "The dnsmasq nft set support is enabled, but dnsmasq is either not installed or installed dnsmasq does not support nft set" - ), - errorNoNft: _( - "The dnsmasq nft sets support is enabled, but nft is not installed" - ), - errorNoWanGateway: _( - "The %s failed to discover WAN gateway" - ).format(pkg.Name), - errorOutputDirCreate: _("Failed to create directory for %s file"), - errorOutputFileCreate: _("Failed to create '%s' file"), - errorFailDNSReload: _("Failed to restart/reload DNS resolver"), - errorSharedMemory: _("Failed to access shared memory"), - errorSorting: _("Failed to sort data file"), - errorOptimization: _("Failed to optimize data file"), - errorAllowListProcessing: _("Failed to process allow-list"), - errorDataFileFormatting: _("Failed to format data file"), - errorMovingDataFile: _( - "Failed to move temporary data file to '%s'" - ).format(outputFile), - errorCreatingCompressedCache: _( - "Failed to create compressed cache" - ), - errorRemovingTempFiles: _("Failed to remove temporary files"), - errorRestoreCompressedCache: _("Failed to unpack compressed cache"), - errorRestoreCache: _("Failed to move '%s' to '%s'").format( - outputCache, - outputFile - ), - errorOhSnap: _( - "Failed to create block-list or restart DNS resolver" - ), - errorStopping: _("Failed to stop %s").format(pkg.Name), - errorDNSReload: _("Failed to reload/restart DNS resolver"), - errorDownloadingConfigUpdate: _( - "Failed to download Config Update file" - ), - errorDownloadingList: _("Failed to download %s"), - errorParsingConfigUpdate: _("Failed to parse Config Update file"), - errorParsingList: _("Failed to parse %s"), - errorNoSSLSupport: _("No HTTPS/SSL support on device"), - errorCreatingDirectory: _( - "Failed to create output/cache/gzip file directory" - ), - errorDetectingFileType: _("Failed to detect format %s"), - errorNothingToDo: _( - "No blocked list URLs nor blocked-domains enabled" - ), - errorTooLittleRam: _( - "Free ram (%s) is not enough to process all enabled block-lists" - ), - errorCreatingBackupFile: _("failed to create backup file %s"), - errorDeletingDataFile: _("failed to delete data file %s"), - errorRestoringBackupFile: _("failed to restore backup file %s"), - errorNoOutputFile: _("failed to create final block-list %s"), - }; - var errorsTitle = E( - "label", - { class: "cbi-value-title" }, - _("Service Errors") - ); - var text = ""; - reply.status.errors.forEach((element) => { - if (element.id && errorTable[element.id]) - text += - errorTable[element.id].format(element.extra || " ") + "!
"; - else text += _("Unknown error") + "
"; - }); - text += _("Errors encountered, please check the %sREADME%s").format( - '', - "!
" - ); - var errorsText = E("div", {}, text); - var errorsField = E("div", { class: "cbi-value-field" }, errorsText); - errorsDiv = E("div", { class: "cbi-value" }, [ - errorsTitle, - errorsField, - ]); - } - - var btn_gap = E("span", {}, "  "); - var btn_gap_long = E( - "span", - {}, - "        " - ); + var btn_gap = E("span", {}, "  "); + var btn_gap_long = E( + "span", + {}, + "        " + ); - var btn_start = E( - "button", - { - class: "btn cbi-button cbi-button-apply", - disabled: true, - click: function (ev) { - ui.showModal(null, [ - E( - "p", - { class: "spinning" }, - _("Starting %s service").format(pkg.Name) - ), - ]); - return RPC.setInitAction(pkg.Name, "start"); - }, + var btn_start = E( + "button", + { + class: "btn cbi-button cbi-button-apply", + disabled: true, + click: function (ev) { + ui.showModal(null, [ + E( + "p", + { class: "spinning" }, + _("Starting %s service").format(pkg.Name) + ), + ]); + return RPC.setInitAction(pkg.Name, "start"); }, - _("Start") - ); + }, + _("Start") + ); - var btn_action_dl = E( - "button", - { - class: "btn cbi-button cbi-button-apply", - disabled: true, - click: function (ev) { - ui.showModal(null, [ - E( - "p", - { class: "spinning" }, - _("Force redownloading %s block lists").format(pkg.Name) - ), - ]); - return RPC.setInitAction(pkg.Name, "dl"); - }, + var btn_action_dl = E( + "button", + { + class: "btn cbi-button cbi-button-apply", + disabled: true, + click: function (ev) { + ui.showModal(null, [ + E( + "p", + { class: "spinning" }, + _("Force redownloading %s block lists").format(pkg.Name) + ), + ]); + return RPC.setInitAction(pkg.Name, "dl"); }, - _("Redownload") - ); + }, + _("Redownload") + ); - var btn_action_pause = E( - "button", - { - class: "btn cbi-button cbi-button-apply", - disabled: true, - click: function (ev) { - ui.showModal(null, [ - E("p", { class: "spinning" }, _("Pausing %s").format(pkg.Name)), - ]); - return RPC.setInitAction(pkg.Name, "pause"); - }, + var btn_action_pause = E( + "button", + { + class: "btn cbi-button cbi-button-apply", + disabled: true, + click: function (ev) { + ui.showModal(null, [ + E("p", { class: "spinning" }, _("Pausing %s").format(pkg.Name)), + ]); + return RPC.setInitAction(pkg.Name, "pause"); }, - _("Pause") - ); + }, + _("Pause") + ); - var btn_stop = E( - "button", - { - class: "btn cbi-button cbi-button-reset", - disabled: true, - click: function (ev) { - ui.showModal(null, [ - E( - "p", - { class: "spinning" }, - _("Stopping %s service").format(pkg.Name) - ), - ]); - return RPC.setInitAction(pkg.Name, "stop"); - }, + var btn_stop = E( + "button", + { + class: "btn cbi-button cbi-button-reset", + disabled: true, + click: function (ev) { + ui.showModal(null, [ + E( + "p", + { class: "spinning" }, + _("Stopping %s service").format(pkg.Name) + ), + ]); + return RPC.setInitAction(pkg.Name, "stop"); }, - _("Stop") - ); + }, + _("Stop") + ); - var btn_enable = E( - "button", - { - class: "btn cbi-button cbi-button-apply", - disabled: true, - click: function (ev) { - ui.showModal(null, [ - E( - "p", - { class: "spinning" }, - _("Enabling %s service").format(pkg.Name) - ), - ]); - return RPC.setInitAction(pkg.Name, "enable"); - }, + var btn_enable = E( + "button", + { + class: "btn cbi-button cbi-button-apply", + disabled: true, + click: function (ev) { + ui.showModal(null, [ + E( + "p", + { class: "spinning" }, + _("Enabling %s service").format(pkg.Name) + ), + ]); + return RPC.setInitAction(pkg.Name, "enable"); }, - _("Enable") - ); + }, + _("Enable") + ); - var btn_disable = E( - "button", - { - class: "btn cbi-button cbi-button-reset", - disabled: true, - click: function (ev) { - ui.showModal(null, [ - E( - "p", - { class: "spinning" }, - _("Disabling %s service").format(pkg.Name) - ), - ]); - return RPC.setInitAction(pkg.Name, "disable"); - }, + var btn_disable = E( + "button", + { + class: "btn cbi-button cbi-button-reset", + disabled: true, + click: function (ev) { + ui.showModal(null, [ + E( + "p", + { class: "spinning" }, + _("Disabling %s service").format(pkg.Name) + ), + ]); + return RPC.setInitAction(pkg.Name, "disable"); }, - _("Disable") - ); - - if (reply.status.enabled) { - btn_enable.disabled = true; - btn_disable.disabled = false; - switch (reply.status.status) { - case "statusSuccess": - btn_start.disabled = true; - btn_action_dl.disabled = false; - btn_action_pause.disabled = false; - btn_stop.disabled = false; - break; - case "statusStopped": - btn_start.disabled = false; - btn_action_dl.disabled = true; - btn_action_pause.disabled = true; - btn_stop.disabled = true; - break; - default: - btn_start.disabled = false; - btn_action_dl.disabled = true; - btn_action_pause.disabled = true; - btn_stop.disabled = false; - btn_enable.disabled = true; - btn_disable.disabled = true; - break; - } - } else { - btn_start.disabled = true; - btn_action_dl.disabled = true; - btn_action_pause.disabled = true; - btn_stop.disabled = true; - btn_enable.disabled = false; - btn_disable.disabled = true; - } + }, + _("Disable") + ); - var buttonsDiv = []; - var buttonsTitle = E( - "label", - { class: "cbi-value-title" }, - _("Service Control") - ); - var buttonsText = E("div", {}, [ - btn_start, - btn_gap, - // btn_action_pause, - // btn_gap, - btn_action_dl, - btn_gap, - btn_stop, - btn_gap_long, - btn_enable, - btn_gap, - btn_disable, - ]); - var buttonsField = E("div", { class: "cbi-value-field" }, buttonsText); - if (reply.status.version) { - buttonsDiv = E("div", { class: "cbi-value" }, [ - buttonsTitle, - buttonsField, - ]); + if (reply.status.enabled) { + btn_enable.disabled = true; + btn_disable.disabled = false; + switch (reply.status.status) { + case "statusSuccess": + btn_start.disabled = true; + btn_action_dl.disabled = false; + btn_action_pause.disabled = false; + btn_stop.disabled = false; + break; + case "statusStopped": + btn_start.disabled = false; + btn_action_dl.disabled = true; + btn_action_pause.disabled = true; + btn_stop.disabled = true; + break; + default: + btn_start.disabled = false; + btn_action_dl.disabled = true; + btn_action_pause.disabled = true; + btn_stop.disabled = false; + btn_enable.disabled = true; + btn_disable.disabled = true; + break; } + } else { + btn_start.disabled = true; + btn_action_dl.disabled = true; + btn_action_pause.disabled = true; + btn_stop.disabled = true; + btn_enable.disabled = false; + btn_disable.disabled = true; + } - return E("div", {}, [ - header, - statusDiv, - warningsDiv, - errorsDiv, - buttonsDiv, + var buttonsDiv = []; + var buttonsTitle = E( + "label", + { class: "cbi-value-title" }, + _("Service Control") + ); + var buttonsText = E("div", {}, [ + btn_start, + btn_gap, + // btn_action_pause, + // btn_gap, + btn_action_dl, + btn_gap, + btn_stop, + btn_gap_long, + btn_enable, + btn_gap, + btn_disable, + ]); + var buttonsField = E("div", { class: "cbi-value-field" }, buttonsText); + if (reply.status.version) { + buttonsDiv = E("div", { class: "cbi-value" }, [ + buttonsTitle, + buttonsField, ]); } - ); + + return E("div", {}, [ + header, + statusDiv, + warningsDiv, + errorsDiv, + buttonsDiv, + ]); + }); }, }); @@ -532,4 +584,5 @@ return L.Class.extend({ getInitStatus: getInitStatus, getFileUrlFilesizes: getFileUrlFilesizes, getPlatformSupport: getPlatformSupport, + getUbusInfo: getUbusInfo, }); diff --git a/applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/adblock-fast/overview.js b/applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/adblock-fast/overview.js index 83374e5b7d..6bbd401126 100644 --- a/applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/adblock-fast/overview.js +++ b/applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/adblock-fast/overview.js @@ -175,17 +175,17 @@ return view.extend({ "tab_basic", form.ListValue, "dnsmasq_instance_option", - _("Use AdBlocking on the dnsmasq instance(s)"), + _("Use ad-blocking on the dnsmasq instance(s)"), _( - "You can limit the AdBlocking to the specific dnsmasq instance(s) (%smore information%s)." + "You can limit the ad-blocking to the specific dnsmasq instance(s) (%smore information%s)." ).format( '', "" ) ); - o.value("*", _("AdBlock on all instances")); - o.value("+", _("AdBlock on select instances")); - o.value("-", _("No AdBlock on dnsmasq")); + o.value("*", _("Ad-blocking on all instances")); + o.value("+", _("Ad-blocking on select instances")); + o.value("-", _("No Ad-blocking on dnsmasq")); o.default = "*"; o.depends("dns", "dnsmasq.addnhosts"); o.depends("dns", "dnsmasq.servers"); @@ -214,7 +214,7 @@ return view.extend({ "tab_basic", form.MultiValue, "dnsmasq_instance", - _("Pick the dnsmasq instance(s) for AdBlocking") + _("Pick the dnsmasq instance(s) for ad-blocking") ); Object.values(L.uci.sections("dhcp", "dnsmasq")).forEach(function ( element @@ -239,17 +239,17 @@ return view.extend({ "tab_basic", form.ListValue, "smartdns_instance_option", - _("Use AdBlocking on the SmartDNS instance(s)"), + _("Use ad-blocking on the SmartDNS instance(s)"), _( - "You can limit the AdBlocking to the specific SmartDNS instance(s) (%smore information%s)." + "You can limit the ad-blocking to the specific SmartDNS instance(s) (%smore information%s)." ).format( '', "" ) ); - o.value("*", _("AdBlock on all instances")); - o.value("+", _("AdBlock on select instances")); - o.value("-", _("No AdBlock on SmartDNS")); + o.value("*", _("Ad-blocking on all instances")); + o.value("+", _("Ad-blocking on select instances")); + o.value("-", _("No Ad-blocking on SmartDNS")); o.default = "*"; o.depends("dns", "smartdns.domainset"); o.retain = true; @@ -277,7 +277,7 @@ return view.extend({ "tab_basic", form.MultiValue, "smartdns_instance", - _("Pick the SmartDNS instance(s) for AdBlocking") + _("Pick the SmartDNS instance(s) for ad-blocking") ); Object.values(L.uci.sections("smartdns", "smartdns")).forEach(function ( element diff --git a/applications/luci-app-adblock-fast/po/templates/adblock-fast.pot b/applications/luci-app-adblock-fast/po/templates/adblock-fast.pot index 2b20743ebe..1d6fd0d1e1 100644 --- a/applications/luci-app-adblock-fast/po/templates/adblock-fast.pot +++ b/applications/luci-app-adblock-fast/po/templates/adblock-fast.pot @@ -1,11 +1,11 @@ msgid "" msgstr "Content-Type: text/plain; charset=UTF-8" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:245 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:300 msgid "%s is currently disabled" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:117 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:170 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/status/include/70_adblock-fast.js:39 msgid "%s is not installed or not found" msgstr "" @@ -22,23 +22,23 @@ msgstr "" msgid "Action" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:127 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:178 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/status/include/70_adblock-fast.js:49 msgid "Active" msgstr "" -#: applications/luci-app-adblock-fast/root/usr/share/luci/menu.d/luci-app-adblock-fast.json:3 -msgid "AdBlock Fast" -msgstr "" - #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/adblock-fast/overview.js:186 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/adblock-fast/overview.js:250 -msgid "AdBlock on all instances" +msgid "Ad-blocking on all instances" msgstr "" #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/adblock-fast/overview.js:187 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/adblock-fast/overview.js:251 -msgid "AdBlock on select instances" +msgid "Ad-blocking on select instances" +msgstr "" + +#: applications/luci-app-adblock-fast/root/usr/share/luci/menu.d/luci-app-adblock-fast.json:3 +msgid "AdBlock Fast" msgstr "" #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/status/include/70_adblock-fast.js:10 @@ -57,7 +57,7 @@ msgstr "" msgid "AdBlock-Fast - Configuration" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:130 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:181 msgid "AdBlock-Fast - Status" msgstr "" @@ -105,7 +105,7 @@ msgstr "" msgid "Blocked Domains" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:143 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:194 msgid "Blocking %s domains (with %s)." msgstr "" @@ -117,11 +117,11 @@ msgstr "" msgid "Cache file" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:169 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:217 msgid "Cache file found." msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:212 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:263 msgid "Can't detect free RAM" msgstr "" @@ -129,15 +129,15 @@ msgstr "" msgid "Compressed cache" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:148 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:199 msgid "Compressed cache file created." msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:171 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:219 msgid "Compressed cache file found." msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:243 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:298 msgid "Config (%s) validation failure!" msgstr "" @@ -171,7 +171,7 @@ msgid "" "Directory for compressed cache file of block-list in the persistent memory." msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:448 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:501 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/adblock-fast/overview.js:347 msgid "Disable" msgstr "" @@ -180,11 +180,11 @@ msgstr "" msgid "Disable Debugging" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:165 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:214 msgid "Disabled" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:442 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:495 msgid "Disabling %s service" msgstr "" @@ -208,12 +208,12 @@ msgstr "" msgid "Download time-out (in seconds)" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:125 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:176 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/status/include/70_adblock-fast.js:45 msgid "Downloading lists" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:429 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:482 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/adblock-fast/overview.js:348 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/adblock-fast/overview.js:502 msgid "Enable" @@ -228,7 +228,7 @@ msgstr "" msgid "Enables debug output to /tmp/adblock-fast.log." msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:423 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:476 msgid "Enabling %s service" msgstr "" @@ -236,7 +236,7 @@ msgstr "" msgid "Error" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:322 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:375 msgid "Errors encountered, please check the %sREADME%s" msgstr "" @@ -244,95 +244,95 @@ msgstr "" msgid "Fail" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:266 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:319 msgid "Failed to access shared memory" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:264 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:317 msgid "Failed to create '%s' file" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:284 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:334 msgid "Failed to create block-list or restart DNS resolver" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:275 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:327 msgid "Failed to create compressed cache" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:263 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:316 msgid "Failed to create directory for %s file" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:296 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:345 msgid "Failed to create output/cache/gzip file directory" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:298 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:347 msgid "Failed to detect format %s" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:291 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:340 msgid "Failed to download %s" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:289 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:338 msgid "Failed to download Config Update file" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:270 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:323 msgid "Failed to format data file" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:279 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:330 msgid "Failed to move '%s' to '%s'" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:272 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:325 msgid "Failed to move temporary data file to '%s'" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:268 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:321 msgid "Failed to optimize data file" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:293 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:342 msgid "Failed to parse %s" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:292 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:341 msgid "Failed to parse Config Update file" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:269 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:322 msgid "Failed to process allow-list" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:287 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:336 msgid "Failed to reload/restart DNS resolver" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:277 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:328 msgid "Failed to remove temporary files" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:265 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:318 msgid "Failed to restart/reload DNS resolver" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:267 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:320 msgid "Failed to sort data file" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:126 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:177 msgid "Failed to start" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:286 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:335 msgid "Failed to stop %s" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:278 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:329 msgid "Failed to unpack compressed cache" msgstr "" @@ -340,11 +340,11 @@ msgstr "" msgid "Force DNS Ports" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:151 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:202 msgid "Force DNS ports:" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:124 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:175 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/status/include/70_adblock-fast.js:44 msgid "Force Reloading" msgstr "" @@ -357,7 +357,7 @@ msgstr "" msgid "Force Router DNS server to all local devices" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:370 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:423 msgid "Force redownloading %s block lists" msgstr "" @@ -365,7 +365,7 @@ msgstr "" msgid "Forces Router DNS use on local devices, also known as DNS Hijacking." msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:303 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:352 msgid "Free ram (%s) is not enough to process all enabled block-lists" msgstr "" @@ -373,6 +373,10 @@ msgstr "" msgid "Grant UCI and file access for luci-app-adblock-fast" msgstr "" +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:359 +msgid "Heartbeat domain is not accessible after resolver restart" +msgstr "" + #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/adblock-fast/overview.js:355 msgid "IPv6 Support" msgstr "" @@ -397,7 +401,14 @@ msgstr "" msgid "Individual domains to be blocked." msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:210 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:246 +msgid "" +"Internal version mismatch (package: %s, luci app: %s, luci rpcd: %s), you " +"may need to update packages or reboot the device, please check the " +"%sREADME%s." +msgstr "" + +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:261 msgid "Invalid compressed cache directory '%s'" msgstr "" @@ -415,7 +426,7 @@ msgstr "" msgid "Let local devices use their own DNS servers if set" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:201 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:252 msgid "Missing recommended package: '%s'" msgstr "" @@ -428,22 +439,22 @@ msgid "Name/URL" msgstr "" #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/adblock-fast/overview.js:252 -msgid "No AdBlock on SmartDNS" +msgid "No Ad-blocking on SmartDNS" msgstr "" #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/adblock-fast/overview.js:188 -msgid "No AdBlock on dnsmasq" +msgid "No Ad-blocking on dnsmasq" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:294 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:343 msgid "No HTTPS/SSL support on device" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:300 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:349 msgid "No blocked list URLs nor blocked-domains enabled" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:185 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:233 msgid "Not installed or not found" msgstr "" @@ -451,11 +462,11 @@ msgstr "" msgid "Output Verbosity Setting" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:391 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:444 msgid "Pause" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:386 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:439 msgid "Pausing %s" msgstr "" @@ -468,11 +479,11 @@ msgid "Pick the LED not already used in %sSystem LED Configuration%s." msgstr "" #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/adblock-fast/overview.js:280 -msgid "Pick the SmartDNS instance(s) for AdBlocking" +msgid "Pick the SmartDNS instance(s) for ad-blocking" msgstr "" #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/adblock-fast/overview.js:217 -msgid "Pick the dnsmasq instance(s) for AdBlocking" +msgid "Pick the dnsmasq instance(s) for ad-blocking" msgstr "" #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/adblock-fast/overview.js:61 @@ -488,33 +499,41 @@ msgstr "" msgid "Please note that %s is not supported on this system." msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:122 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:173 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/status/include/70_adblock-fast.js:42 msgid "Processing lists" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:376 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:429 msgid "Redownload" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:123 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:174 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/status/include/70_adblock-fast.js:43 msgid "Restarting" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:489 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:264 +msgid "Sanity check discovered TLDs in %s" +msgstr "" + +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:266 +msgid "Sanity check discovered leading dots in %s" +msgstr "" + +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:542 msgid "Service Control" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:313 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:365 msgid "Service Errors" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:134 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:185 msgid "Service Status" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:217 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:272 msgid "Service Warnings" msgstr "" @@ -534,16 +553,16 @@ msgstr "" msgid "Some output" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:357 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:410 msgid "Start" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:121 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:172 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/status/include/70_adblock-fast.js:41 msgid "Starting" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:351 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:404 msgid "Starting %s service" msgstr "" @@ -551,7 +570,7 @@ msgstr "" msgid "Status" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:410 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:463 msgid "Stop" msgstr "" @@ -559,12 +578,12 @@ msgstr "" msgid "Stop the download if it is stalled for set number of seconds." msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:120 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:171 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/status/include/70_adblock-fast.js:40 msgid "Stopped" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:404 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:457 msgid "Stopping %s service" msgstr "" @@ -580,38 +599,38 @@ msgstr "" msgid "Suppress output" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:261 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:313 msgid "The %s failed to discover WAN gateway" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:204 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:255 msgid "" "The WebUI application (luci-app-adblock-fast) is outdated, please update it" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:249 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:302 msgid "" "The dnsmasq ipset support is enabled, but dnsmasq is either not installed or " "installed dnsmasq does not support ipset" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:252 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:305 msgid "" "The dnsmasq ipset support is enabled, but ipset is either not installed or " "installed ipset does not support '%s' type" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:255 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:308 msgid "" "The dnsmasq nft set support is enabled, but dnsmasq is either not installed " "or installed dnsmasq does not support nft set" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:258 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:311 msgid "The dnsmasq nft sets support is enabled, but nft is not installed" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:207 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:258 msgid "The principal package (adblock-fast) is outdated, please update it" msgstr "" @@ -634,23 +653,27 @@ msgstr "" msgid "Unknown" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:320 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:372 msgid "Unknown error" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:225 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:32 +msgid "Unknown message" +msgstr "" + +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:279 msgid "Unknown warning" msgstr "" #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/adblock-fast/overview.js:242 -msgid "Use AdBlocking on the SmartDNS instance(s)" +msgid "Use ad-blocking on the SmartDNS instance(s)" msgstr "" #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/adblock-fast/overview.js:178 -msgid "Use AdBlocking on the dnsmasq instance(s)" +msgid "Use ad-blocking on the dnsmasq instance(s)" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:198 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:249 msgid "" "Use of external dnsmasq config file detected, please set '%s' option to '%s'" msgstr "" @@ -667,7 +690,7 @@ msgstr "" msgid "Version" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:137 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:188 msgid "Version %s" msgstr "" @@ -677,13 +700,13 @@ msgstr "" #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/adblock-fast/overview.js:244 msgid "" -"You can limit the AdBlocking to the specific SmartDNS instance(s) (%smore " +"You can limit the ad-blocking to the specific SmartDNS instance(s) (%smore " "information%s)." msgstr "" #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/adblock-fast/overview.js:180 msgid "" -"You can limit the AdBlocking to the specific dnsmasq instance(s) (%smore " +"You can limit the ad-blocking to the specific dnsmasq instance(s) (%smore " "information%s)." msgstr "" @@ -707,19 +730,19 @@ msgstr "" msgid "dnsmasq servers file" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:305 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:354 msgid "failed to create backup file %s" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:308 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:357 msgid "failed to create final block-list %s" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:306 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:355 msgid "failed to delete data file %s" msgstr "" -#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:307 +#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:356 msgid "failed to restore backup file %s" msgstr "" diff --git a/applications/luci-app-adblock-fast/root/usr/libexec/rpcd/luci.adblock-fast b/applications/luci-app-adblock-fast/root/usr/libexec/rpcd/luci.adblock-fast index 546df1d81d..ff7c1bd5ce 100755 --- a/applications/luci-app-adblock-fast/root/usr/libexec/rpcd/luci.adblock-fast +++ b/applications/luci-app-adblock-fast/root/usr/libexec/rpcd/luci.adblock-fast @@ -9,12 +9,13 @@ # ubus -S call luci.adblock-fast getInitList '{"name": "adblock-fast" }' # ubus -S call luci.adblock-fast getInitStatus '{"name": "adblock-fast" }' # ubus -S call luci.adblock-fast getPlatformSupport '{"name": "adblock-fast" }' +# ubus -S call luci.adblock-fast getUbusInfo '{"name": "adblock-fast" }' # ubus -S call luci.adblock-fast setInitAction '{"name": "adblock-fast", "action": "start" }' # ubus -S call luci.adblock-fast setInitAction '{"name": "adblock-fast", "action": "dl" }' # ubus -S call luci.adblock-fast setInitAction '{"name": "adblock-fast", "action": "pause" }' # ubus -S call luci.adblock-fast setInitAction '{"name": "adblock-fast", "action": "stop" }' -readonly luciCompat='4' +readonly rpcdCompat='7' readonly adbFunctionsFile='/etc/init.d/adblock-fast' if [ -s "$adbFunctionsFile" ]; then # shellcheck source=../../../../../adblock-fast/files/etc/init.d/adblock-fast @@ -100,8 +101,8 @@ get_init_status() { local name name="$(basename "$1")" name="${name:-$packageName}" - local errors warnings ports dns outputFile outputCache outputGzip outputConfig - local i j + local ports dns outputFile outputCache outputGzip outputConfig + local i j k # shellcheck disable=SC2034 local compressed_cache_dir config_load "$name" @@ -113,65 +114,20 @@ get_init_status() { else dns="$(uci_get "$packageName" 'config' 'dns' 'dnsmasq.servers')" fi - dns_set_output_values "$dns" json_init - json_add_object "$name" - json_add_boolean 'enabled' "$(is_enabled "$name")" - json_add_string 'status' "$(json 'get' 'status')" + json_add_object "$name" + json_add_boolean 'enabled' "$(is_enabled "$name")" + json_add_string 'status' "$(json 'get' 'status')" + json_add_string 'version' "$PKG_VERSION" + json_add_int 'packageCompat' "${packageCompat:-0}" + json_add_int 'rpcdCompat' "${rpcdCompat:-0}" if is_running "$name"; then json_add_boolean 'running' '1' else json_add_boolean 'running' '0' fi - json_add_string 'version' "$PKG_VERSION" - errors="$(ubus_get_data errors)" - json_add_array 'errors' - if [ -n "$errors" ]; then - for i in $errors; do - if str_contains "$i" '|'; then - error_extra="${i##*|}" - error_id="${i%|*}" - else - error_id="$i" - unset error_extra - fi - json_add_object - json_add_string 'id' "$error_id" - json_add_string 'extra' "$error_extra" - json_close_object - done - fi - json_close_array - warnings="$(ubus_get_data warnings)" - json_add_array 'warnings' - if [ -n "$warnings" ]; then - for i in $warnings; do - if str_contains "$i" '|'; then - error_extra="${i##*|}" - error_id="${i%|*}" - else - error_id="$i" - unset error_extra - fi - json_add_object - json_add_string 'id' "$error_id" - json_add_string 'extra' "$error_extra" - json_close_object - done - fi - if is_greater "${packageCompat:-0}" "${luciCompat:-0}"; then - json_add_object - json_add_string 'id' 'warningOutdatedLuciPackage' - json_close_object - elif is_greater "${luciCompat:-0}" "${packageCompat:-0}"; then - json_add_object - json_add_string 'id' 'warningOutdatedPrincipalPackage' - json_close_object - fi - json_close_array - ports="$(ubus_get_ports)" if [ -n "$ports" ]; then json_add_boolean 'force_dns_active' '1' @@ -202,7 +158,11 @@ get_init_status() { json_add_boolean 'outputGzipExists' '0' fi json_add_array 'leds' - for i in /sys/class/leds/*; do json_add_string '' "$(basename "$i")"; done + if ls /sys/class/leds/* >/dev/null 2>&1; then + for i in /sys/class/leds/*; do + [ -d "$i" ] && json_add_string '' "$(basename "$i")" + done + fi json_close_array json_close_object json_dump @@ -268,6 +228,13 @@ get_platform_support() { json_cleanup } +get_ubus_info() { + local name + name="$(basename "$1")" + name="${name:-$packageName}" + ubus call service list '{"name":"'"$name"'"}' +} + case "$1" in list) json_init @@ -283,6 +250,9 @@ case "$1" in json_add_object "getPlatformSupport" json_add_string 'name' 'name' json_close_object + json_add_object "getUbusInfo" + json_add_string 'name' 'name' + json_close_object json_add_object "setInitAction" json_add_string 'name' 'name' json_add_string 'action' 'action' @@ -320,6 +290,13 @@ case "$1" in json_cleanup get_platform_support "$name" ;; + getUbusInfo) + read -r input + json_load "$input" + json_get_var name 'name' + json_cleanup + get_ubus_info "$name" + ;; setInitAction) read -r input json_load "$input" diff --git a/applications/luci-app-adblock-fast/root/usr/share/rpcd/acl.d/luci-app-adblock-fast.json b/applications/luci-app-adblock-fast/root/usr/share/rpcd/acl.d/luci-app-adblock-fast.json index df272abe1c..c9484ee547 100644 --- a/applications/luci-app-adblock-fast/root/usr/share/rpcd/acl.d/luci-app-adblock-fast.json +++ b/applications/luci-app-adblock-fast/root/usr/share/rpcd/acl.d/luci-app-adblock-fast.json @@ -3,16 +3,16 @@ "description": "Grant UCI and file access for luci-app-adblock-fast", "read": { "file": { - "/dev/shm/adblock-fast.config": [ "list", "read" ], - "/dev/shm/adblock-fast.error": [ "list", "read" ], - "/dev/shm/adblock-fast.status": [ "list", "read" ] + "/dev/shm/adblock-fast": [ "list", "read" ], + "/dev/shm/adblock-fast.status.json": [ "list", "read" ] }, "ubus": { "luci.adblock-fast": [ "getFileUrlFilesizes", "getInitList", "getInitStatus", - "getPlatformSupport" + "getPlatformSupport", + "getUbusInfo" ] }, "uci": [